package cn.shenlong.mybatis.dialect;

/**
 * Mysql 方言
 * 
 */
public class MysqlDialect extends Dialect {

	public boolean supportsLimit() {
		return true;
	}

	public boolean supportsLimitOffset() {
		return true;
	}

	public String getLimitString(String sql, int offset,
			String offsetPlaceholder, int limit, String limitPlaceholder) {
		sql = sql.trim();

		StringBuffer pagingSelect = new StringBuffer(sql.length() + 100);

		pagingSelect.append("select * from (  ");
		pagingSelect.append(sql);
 
		pagingSelect.append(" )  _mysql_table limit  ").append(offset)
				.append(",").append(limit);

		return pagingSelect.toString();
	}

}
